package com.plian.system.wrapper.im;

import com.plian.system.dto.im.FixedInvestmentPlanDTO;
import com.plian.system.entity.im.FixedInvestmentPlan;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.im.FixedInvestmentPlanVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * @description:
 * @author: gangan
 * @create: 2020-04-23 14:14
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface FixedInvestmentPlanWrapper extends BaseWrapper<FixedInvestmentPlan, FixedInvestmentPlanDTO, FixedInvestmentPlanVO> {


    /**
     * Entity转VO
     *
     * @param entity /
     * @return /
     */
    @Override
    @Mappings(value = {
            @Mapping(source = "investmentCompanyId", target = "investmentCompanyId", qualifiedByName = STR_NULL_TO_EMPTY),
            @Mapping(source = "investmentCompanyId", target = "investmentCompanyName", defaultValue = ""),
            @Mapping(source = "projectNatureId", target = "projectNatureName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "investmentCompanyRankId", target = "investmentCompanyRankName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "isNewProject", target = "isNewProjectStr", qualifiedByName = IS_OR_NO),
    })
    FixedInvestmentPlanVO entityToVO(FixedInvestmentPlan entity);
}
